CREATE TRIGGER TGPN_02 ON PHIEUNHAP
INSTEAD OF DELETE
AS
BEGIN
	DECLARE @MAPN VARCHAR(50)
	SET @MAPN = (SELECT MAPHIEUNHAP FROM deleted)
	DELETE FROM ChiTietPhieuNhap WHERE MaPhieuNhap = @MAPN
	DELETE FROM PhieuNhap WHERE MaPhieuNhap=@MAPN
	RAISERROR('XOA CHI TIET NHAP THANH CONG',16,1)
END